﻿using EnterpriseInformation.Common;
using HtmlAgilityPack;
using Newtonsoft.Json.Linq;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;

namespace EnterpriseInformation.DataModel
{
    public class CompanyBase1 : CustomLog
    {
        public CompanyBase1()
        {
            InitLog();
            basedetail = new basedetail();
            mpeoples = new List<Mpeople>();
            beneficiarys = new List<Beneficiary>();
            stockholders = new List<Stockholder>();
        }

        public basedetail basedetail { get; set; }
        public List<Mpeople> mpeoples { get; set; }
        /// <summary>
        /// 最终受益人
        /// </summary>
        public List<Beneficiary> beneficiarys { get; set; }
        /// <summary>
        /// 工商自主公示- 股东及出资信息 
        /// </summary>
        public List<Stockholder> stockholders { get; set; }
        /// <summary>
        /// 股权变更信息
        /// </summary>
        public List<StockChange> stockchanges { get; set; }
        /// <summary>
        /// 财务分析
        /// </summary>
        public newFinancialAnalysis newfinancialanalysis { get; set; }
        /// <summary>
        /// 同业分析
        /// </summary>
        public newIndicatorData newindicatordata { get; set; }
        /// <summary>
        /// 变更记录
        /// </summary>
        public Changelist changelist { get; set; }
        ///
        
        /// <summary>
        /// 
        /// </summary>
        /// <param name="htmlContent"></param>
        /// <param name="CompanyId"></param>

        public void Init(string htmlContent,string CompanyId)
        {
            try
            {
                //https://www.cnblogs.com/browser/p/4455527.html
                //var document = new HtmlDocument { OptionAutoCloseOnEnd = true };
                //document.LoadHtml(item.content.Replace("\r", "").Replace("\n", ""));
                //HtmlNodeCollection panelBodys = document.DocumentNode.SelectNodes("//div[@class='law-title']");
                //HtmlNode panelBodys1 = document.DocumentNode.SelectSingleNode("//div[@id='law-title']");
                //doc.DocumentNode.SelectNodes("//section[@class=\"ntable ntable-list\"]/table/*/tr");
                ///选择不包含class属性的节点
                //var result = node.SelectNodes(".//span[not(@class)]");
                //选择不包含class和id属性的节点
                //var result = node.SelectNodes(".//span[not(@class) and not(@id)]");
                //选择不包含class="expire"的span
                //var result = node.SelectNodes(".//span[not(contains(@class,'expire'))]");
                //选择包含class="expire"的span
                //var result = node.SelectNodes(".//span[contains(@class,'expire')]");
                //通配符
                //可用* 表示任意节点名称，比如 SelectNodes("/channel/*/item")；
                //用 @*表示任意属性；
                //用 node() 表示任意类型的节点；
                //用 text() 表示文本类型的节点，实际上也就是表示取文本节点（元素节点下面是文本节点，文本节点下面才是文字）。
                //运算符
                //表示或。SelectNodes("//item|//channel")，选择 item 或 channel 节点。

                //所有元素 //*
                //所有的P元素 //p
                //所有的p元素的子元素  	//p/*
                //根据ID获取元素	//*[@id='foo']
                //根据Class获取元素     //*[contains(@class,'foo')] 1
                //拥有某个属性的元素 	//*[@title]
                //所有P元素的第一个子元素 	//p/*[0]
                //所有拥有子元素a的P元素   	//p[a]
                //class="foo"	//*[@class='foo']	class属性只有一个值foo
                //class="foobar foo bar"	//*[@class=' foo ']	class属性值中,foo在其他两边的值的中间
                //class="foo bar"//*[starts-with(@class,'foo ')]	class属性值中,foo在最左边
                //class="bar foo"	//*[substring(@class,string-length(@class)-3)=' foo']	class属性值中,foo在最右边,XPath1.0中没有ends-with函数,2.0有,现在浏览器实现的都是1.0
                
                //  1，  .//span  当前节点下的所有  //span 全局节点下的所有   span 当前节点的儿子节点（不包含儿子的儿子）   /span 当前节点平级节点
                HtmlDocument doc = new HtmlDocument();
                doc.OptionAutoCloseOnEnd = true;
                doc.LoadHtml(htmlContent);
                
                basedetail.CompanyId = CompanyId;
                basedetail.CompanyName = doc.DocumentNode.SelectSingleNode("//div[@id=\"company-top\"].//div[@class=\"content\"]/div[@class=\"row title jk-tip\"]/h1")?.InnerText.Trim();
                basedetail.CompanyIMG = doc.DocumentNode.SelectSingleNode("//div[@id=\"company-top\"].//div[@class=\"imgkuang\"]/img").Attributes["src"]?.Value.Trim();
                HtmlNodeCollection tagNodes =
                     doc.DocumentNode.SelectNodes("//div[@class=\"content\"]/div[contains(@class,\"row\") and contains(@class,\"tags\")]");
                HtmlNodeCollection childTagNodes = tagNodes[0].SelectNodes("./*/text()|./*/*/text()");
                foreach (HtmlNode childNoteItem in childTagNodes)
                {
                    string tagText = childNoteItem.InnerText.Replace(" ", "").Replace("\n", "");
                    if (!string.IsNullOrEmpty(tagText) && !tagText.Contains("风险") && !tagText.Contains("条"))
                    {
                        basedetail.TagList.Add(tagText);
                    }
                }

                HtmlNodeCollection basicRows = doc.DocumentNode.SelectNodes("//div[@class=\"dcontent\"]/div[@class=\"row\"]");

                HtmlNodeCollection phoneNodes = basicRows[0].SelectNodes("./span[contains(@class,\"fc\")]/span[contains(@class,\"cvlu\")]");

                var phoneNodeSpan = phoneNodes[0].SelectNodes("./span/text()").Where(p => !string.IsNullOrEmpty(p.InnerText.Replace(" ",""))).ToList();

                string phoneNum = string.Empty;

                if (phoneNodeSpan != null && phoneNodeSpan.Count > 0)
                {
                    phoneNum = phoneNodeSpan[0].InnerText;

                }
                else
                {

                    phoneNum = phoneNodes[0].InnerText;
                }

                basedetail.PhoneNum = phoneNum.Replace(" ", "").Trim();
                basedetail.WebSite = basicRows[0].SelectNodes("./span[contains(@class,\"cvlu\")]/a")[0].InnerText.Replace(" ", "").Trim();
                HtmlNodeCollection mailBoxNodes = basicRows[1].SelectNodes("./span[contains(@class,\"fc\")]/span");
                HtmlNodeCollection mailBoxNode = mailBoxNodes[1].SelectNodes("./a");
                string mailBox = string.Empty;
                if (mailBoxNode != null && mailBoxNode.Count > 0)
                {
                    mailBox = mailBoxNode[0].InnerText;

                }
                else
                {

                    mailBox = mailBoxNodes[0].InnerText;
                }
                basedetail.MailBox = mailBox.Replace(" ", "").Trim();


                basedetail.Address = basicRows[1].SelectNodes("./span[contains(@class,\"cvlu\")]/a/text()")[0].InnerText.Replace(" ", "");
                string intruduce = string.Empty;

                if (basicRows.Count > 2)
                {
                    intruduce = basicRows[2].SelectNodes("./span[contains(@class,\"introExpand\")]/text()")[0].InnerText;

                }

                basedetail.Intruduce = intruduce.Replace(" ", "").Trim();
                ///////
                HtmlNodeCollection ComInfos = doc.DocumentNode.SelectNodes("//section[@id=\"Cominfo\"].//tr");
                basedetail.LegalRepId = ComInfos[0].SelectSingleNode("./td/div[contains(@class,\"boss-td\")].//a[@class=\"bname\"]")?.Attributes["href"]?.Value.Replace("/pl/", "").Replace("/firm/", "").Replace(".html","");
                basedetail.LegalRepName = ComInfos[0].SelectSingleNode("./td/div[contains(@class,\"boss-td\")].//h2")?.InnerText.Replace(" ", "");
                basedetail.LegalRepImg = ComInfos[0].SelectSingleNode("./td/div[contains(@class,\"boss-td\")].//img")?.Attributes["src"]?.Value;
                basedetail.RegistrationStatus = ComInfos[0].SelectNodes("./td")[3]?.InnerText.Replace(" ", "").Trim();
                basedetail.BuildDate = ComInfos[0].SelectNodes("./td")[5].InnerText.Replace(" ", "").Trim();
                //
                basedetail.Capital = ComInfos[1].SelectNodes("./td")[1].InnerText.Replace(" ", "").Trim();
                basedetail.IssuedCapital = ComInfos[1].SelectNodes("./td")[3].InnerText.Replace(" ", "").Trim();
                basedetail.CheckDate = ComInfos[1].SelectNodes("./td")[5].InnerText.Replace(" ", "").Trim();
                //
                basedetail.SocialCode = ComInfos[2].SelectNodes("./td")[1].InnerText.Replace(" ", "").Trim();
                basedetail.OrganizationCode = ComInfos[2].SelectNodes("./td")[3].InnerText.Replace(" ", "").Trim();
                basedetail.RegistrationCode = ComInfos[2].SelectNodes("./td")[5].InnerText.Replace(" ", "").Trim();
                //
                basedetail.TaxpayerCode = ComInfos[3].SelectNodes("./td")[1].InnerText.Trim();
                basedetail.ExportCode = ComInfos[3].SelectNodes("./td")[3].InnerText.Trim();
                basedetail.IndustryCode = ComInfos[3].SelectNodes("./td")[5].InnerText.Trim();
                //
                basedetail.EnterpriseType = ComInfos[4].SelectNodes("./td")[1].InnerText.Trim();
                basedetail.OperationEnding = ComInfos[4].SelectNodes("./td")[3].InnerText.Trim();
                basedetail.Authority = ComInfos[4].SelectNodes("./td")[5].InnerText.Trim();
                //
                basedetail.StaffSize = ComInfos[5].SelectNodes("./td")[1].InnerText.Trim();
                basedetail.InsuredSize = ComInfos[5].SelectNodes("./td")[3].InnerText.Trim();
                basedetail.Area = ComInfos[5].SelectNodes("./td")[5].InnerText.Trim();
                //
                basedetail.OnceName = ComInfos[6].SelectNodes("./td")[1].InnerText.Trim();
                basedetail.EnglishName = ComInfos[6].SelectNodes("./td")[3].InnerText.Trim();
                //
                basedetail.CompanyAddress = ComInfos[7].SelectNodes("./td")[1].SelectNodes("./span/a")[0]?.InnerText.Trim();
                //
                basedetail.CompanyScope = ComInfos[8].SelectNodes("./td")[1].InnerText.Trim();

                //主要负责人
                HtmlNodeCollection mainpeopleCollectTR = doc.DocumentNode.SelectNodes("//div[@id=\"employeeslist\"]/table/tr");
                HtmlNodeCollection titiles = mainpeopleCollectTR[0].SelectNodes("th");
                int Name = -1;
                int Duty = -1;
                int Nueducational = -1;
                int Sex = -1;
                int salary = -1;
                int NumberOfShares = -1;
                int PerOfShares = -1;
                int UltimateBeneficiary = -1;
                int TermOfOffice = -1;
                int PostDate = -1;
                for (int i = 0; i < titiles.Count; i++)
                {
                    if (titiles[i].InnerText.Trim() == "姓名")
                    {
                        Name = i;
                    }
                    if (titiles[i].InnerText.Trim() == "性别")
                    {
                        Sex = i;
                    }
                    if (titiles[i].InnerText.Trim() == "学历")
                    {
                        Nueducational = i;
                    }
                    if (titiles[i].InnerText.Trim() == "职务")
                    {
                        Duty = i;
                    }
                    if (titiles[i].InnerText.Trim() == "薪酬")
                    {
                        salary = i;
                    }
                    if (titiles[i].InnerText.Trim() == "持股数")
                    {
                        NumberOfShares = i;
                    }
                    if (titiles[i].InnerText.Trim() == "持股比例")
                    {
                        PerOfShares = i;
                    }
                    if (titiles[i].InnerText.Trim() == "最终受益股份")
                    {
                        UltimateBeneficiary = i;
                    }
                    if (titiles[i].InnerText.Trim() == "本届任期")
                    {
                        TermOfOffice = i;
                    }
                    if (titiles[i].InnerText.Trim() == "公告日期")
                    {
                        PostDate = i;
                    }
                }
                
                //	
                Mpeople mpeople;
                for (int i = 1; i < mainpeopleCollectTR.Count; i++)
                {
                    mpeople = new Mpeople();
                    HtmlNodeCollection mainpeopleCollectTD = mainpeopleCollectTR[i].SelectNodes("td");
                    mpeople.ID = Name > -1 ? mainpeopleCollectTD[Name].SelectSingleNode("table.//tr/td[2]/a")?.Attributes["href"]?.Value.Replace("/pl/", "").Replace("/firm/", "").Replace(".html", "").Trim() : "";
                    mpeople.IMG = Name > -1 ? mainpeopleCollectTD[Name].SelectSingleNode("table.//img")?.Attributes["src"]?.Value : "";
                    mpeople.Name = Name > -1 ? mainpeopleCollectTD[Name].SelectSingleNode("table.//tr/td[2]/a")?.InnerText.Trim() : "";
                    mpeople.TagList = Name > -1 ? mainpeopleCollectTD[Name].SelectNodes("table.//tr/td[2]/div/span/text()")?.Select(p=>p.InnerText.Trim()).ToList() : new List<string>();
                    mpeople.Relative = Name > -1 ? mainpeopleCollectTD[Name].SelectSingleNode("table.//tr/td[3]/a/text()")?.InnerText.Trim() : "";
                    mpeople.Duty = Duty > -1 ? mainpeopleCollectTD[Duty]?.InnerText.Trim() : "";
                    mpeople.Nueducational = Nueducational > -1 ? mainpeopleCollectTD[Nueducational]?.InnerText.Trim() : "";
                    mpeople.Sex = Sex > -1 ? mainpeopleCollectTD[Sex]?.InnerText.Trim() : "";
                    mpeople.salary = salary > -1 ? mainpeopleCollectTD[salary]?.InnerText.Trim() : "";
                    mpeople.NumberOfShares = NumberOfShares > -1 ? mainpeopleCollectTD[NumberOfShares]?.InnerText.Trim() : "";
                    mpeople.PerOfShares = PerOfShares > -1 ? mainpeopleCollectTD[PerOfShares]?.InnerText.Trim() : "";
                    mpeople.UltimateBeneficiary = UltimateBeneficiary > -1 ? mainpeopleCollectTD[UltimateBeneficiary]?.InnerText.Trim() : "";
                    mpeople.TermOfOffice = TermOfOffice > -1 ? mainpeopleCollectTD[TermOfOffice]?.InnerText.Trim() : "";
                    mpeople.PostDate = PostDate > -1 ? mainpeopleCollectTD[PostDate]?.InnerText.Trim() : "";
                    mpeoples.Add(mpeople);
                }


                ////
                HtmlNodeCollection beneficiaryTRs = doc.DocumentNode.SelectNodes("//section[@id=\"syrlist\"]/table/tr");
                Beneficiary beneficiary;
                foreach (var item in beneficiaryTRs)
                {
                    HtmlNodeCollection beneficiaryTDs = item.SelectNodes("td");
                    if (beneficiaryTDs != null)
                    {
                        beneficiary = new Beneficiary();
                        beneficiary.ID = beneficiaryTDs[0].InnerText.Trim();
                        beneficiary.LegalRepId = beneficiaryTDs[1].SelectSingleNode("div/a")?.Attributes["href"]?.Value.Replace("/pl/", "").Replace("/firm/", "").Replace(".html", "").Trim();
                        beneficiary.LegalRepIMG = beneficiaryTDs[1].SelectSingleNode(".//img")?.Attributes["src"]?.Value.Trim();
                        beneficiary.LegalRepName = beneficiaryTDs[1].SelectSingleNode("div/a")?.InnerText.Trim();
                        beneficiary.LegalRepRelative = beneficiaryTDs[1].SelectSingleNode("div/div/a")?.InnerText.Trim();
                        beneficiary.PerOfShares = beneficiaryTDs[2]?.InnerText.Trim();

                        

                        HtmlNodeCollection beneficiaryDIVs = beneficiaryTDs[3].SelectNodes("div");
                        BeneficiaryPath beneficiarypath;
                        for (int i = 0; i < beneficiaryDIVs.Count; i++)
                        {
                            beneficiarypath = new BeneficiaryPath();
                            if (beneficiaryDIVs[i].GetClasses().Contains("tdpath"))
                            {
                                beneficiarypath.Type = beneficiaryDIVs[i].SelectSingleNode("div")?.InnerText.Trim();
                                LegalRep legalrep;
                                var childnodes = beneficiaryDIVs[i].SelectNodes(".//*");
                                for (int c = 0; c < childnodes.Count; c++)//#text
                                {
                                    legalrep = new LegalRep();
                                    if (childnodes[c].Name == "a")
                                    {
                                        legalrep.LegalRepId = childnodes[c].Attributes["href"]?.Value.Replace("/pl/", "").Replace("/firm/", "").Replace(".html", "");
                                        legalrep.LegalRepIMG = "";
                                        legalrep.LegalRepName = childnodes[c]?.InnerText.Trim();
                                        if (c + 1 < childnodes.Count && childnodes[c+1] != null && childnodes[c + 1].Name == "span")
                                        {
                                            legalrep.LegalRepRelative = childnodes[c + 1]?.InnerText.Trim();
                                        }
                                        legalrep.Order = c;
                                        beneficiarypath.legalreps.Add(legalrep);
                                    }
                                }
                                if (i + 1 < beneficiaryDIVs.Count)
                                {
                                    var rma = beneficiaryDIVs[i + 1]?.GetClasses().Contains("syrtips");
                                    if (rma != null && Convert.ToBoolean(rma))
                                    {
                                        beneficiarypath.Remark = beneficiaryDIVs[i + 1].InnerText.Trim();
                                    }
                                }
                                beneficiary.beneficiarypaths.Add(beneficiarypath);
                            }
                        }
                        beneficiarys.Add(beneficiary);
                    }
                }

                ///stockholders
                HtmlNodeCollection stockholdersTRs = doc.DocumentNode.SelectNodes("//section[@id=\"syrlist\"]/table/tr");
                Stockholder stockholder;
                foreach (var item in beneficiaryTRs)
                {
                    HtmlNodeCollection beneficiaryTDs = item.SelectNodes("td");
                    if (beneficiaryTDs != null)
                    {
                        stockholder = new Stockholder();
                        stockholder.Id = beneficiaryTDs[1].SelectSingleNode(".//a[1]")?.Attributes["href"]?.Value.Replace("/pl/", "").Replace("/firm/", "").Replace(".html", "").Trim();
                        stockholder.IMG = beneficiaryTDs[1].SelectSingleNode(".//img")?.Attributes["src"]?.Value.Trim();
                        var na = beneficiaryTDs[1].SelectSingleNode(".//a[1]");
                        stockholder.Name = na == null? beneficiaryTDs[1].InnerText.Trim(): na.InnerText.Trim();
                        stockholder.Relative = beneficiaryTDs[1].SelectSingleNode(".//a[2]")?.InnerText.Trim();
                        stockholder.PerOfShares = beneficiaryTDs[2].InnerText.Trim();
                        stockholder.GiveMoney = beneficiaryTDs[3].InnerText.Trim();
                        stockholder.GiveDate = beneficiaryTDs[4].InnerText.Trim();
                        stockholder.ActGiveMoney = beneficiaryTDs[5].InnerText.Trim();
                        stockholder.ActGiveDate = beneficiaryTDs[6].InnerText.Trim();
                        stockholders.Add(stockholder);
                    }
                }


                ///stockchanges
                HtmlNodeCollection stockchangesTRs = doc.DocumentNode.SelectNodes("//section[@id=\"syrlist\"]/table/tr");
                StockChange stockchange;
                foreach (var item in beneficiaryTRs)
                {
                    HtmlNodeCollection beneficiaryTDs = item.SelectNodes("td");
                    if (beneficiaryTDs != null)
                    {
                        stockchange = new StockChange();
                        stockchange.Id = beneficiaryTDs[1].SelectSingleNode(".//a[1]")?.Attributes["href"]?.Value.Replace("/pl/", "").Replace("/firm/", "").Replace(".html", "").Trim();
                        stockchange.IMG = beneficiaryTDs[1].SelectSingleNode(".//img")?.Attributes["src"]?.Value.Trim();
                        var na = beneficiaryTDs[1].SelectSingleNode(".//a[1]");
                        stockchange.Name = na == null ? beneficiaryTDs[1].InnerText.Trim() : na.InnerText.Trim();
                        stockchange.Relative = beneficiaryTDs[1].SelectSingleNode(".//a[2]")?.InnerText.Trim();
                        stockchange.Before = beneficiaryTDs[2].InnerText.Trim();
                        stockchange.After = beneficiaryTDs[3].InnerText.Trim();
                        stockchange.ChangeDate = beneficiaryTDs[4].InnerText.Trim();
                        stockchange.PostDate = beneficiaryTDs[5].InnerText.Trim();
                        stockchanges.Add(stockchange);
                    }
                }

                //newFinancialAnalysis
                newfinancialanalysis.HTML = doc.DocumentNode.SelectSingleNode("//section[@id=\"newFinancialAnalysis\"]")?.InnerHtml;

                //newindicatordata
                newindicatordata.HTML = doc.DocumentNode.SelectSingleNode("//section[@id=\"newIndicatorData\"]")?.InnerHtml;

                //
                changelist.HTML = doc.DocumentNode.SelectSingleNode("//section[@id=\"Changelist\"]")?.InnerHtml;

            }
            catch (Exception ex)
            {
                MyLog().Error("基本信息初始化:" + ex.ToString());
            }

        }
        
        
    }


    public class basedetail
    {
        public basedetail()
        {
            TagList = new List<string>();
        }
        public string CompanyId { get; set; }
        /// <summary>
        /// c
        /// </summary>
        public string CompanyName { get; set; }
        /// <summary>
        /// 
        /// </summary>
        public string CompanyIMG { get; set; }
        /// <summary>
        /// 标签
        /// </summary>
        public List<string> TagList { get; set; }
        /// <summary>
        /// 电话
        /// </summary>
        public string PhoneNum { get; set; }
        /// <summary>
        /// 官网
        /// </summary>
        public string WebSite { get; set; }
        /// <summary>
        /// 邮箱
        /// </summary>
        public string MailBox { get; set; }
        /// <summary>
        /// 地址
        /// </summary>
        public string Address { get; set; }
        /// <summary>
        /// 公司简介
        /// </summary>
        public string Intruduce { get; set; }
        /// <summary>
        /// 法人id
        /// </summary>
        public string LegalRepId { get; set; }
        /// <summary>
        /// 法人代表
        /// </summary>
        public string LegalRepName { get; set; }
        /// <summary>
        /// 法人头像
        /// </summary>
        public string LegalRepImg { get; set; }

        /// <summary>
        /// 登记状态
        /// </summary>
        public string RegistrationStatus { get; set; }
        /// <summary>
        /// 成立日期
        /// </summary>
        public string BuildDate { get; set; }
        /// <summary>
        /// 注册资本
        /// </summary>
        public string Capital { get; set; }
        /// <summary>
        /// 实缴资本
        /// </summary>
        public string IssuedCapital { get; set; }
        /// <summary>
        /// 核准日期
        /// </summary>
        public string CheckDate { get; set; }
        /// <summary>
        /// 统一社会信用代码
        /// </summary>
        public string SocialCode { get; set; }
        /// <summary>
        /// 组织机构代码
        /// </summary>
        public string OrganizationCode { get; set; }
        /// <summary>
        /// 工商注册号
        /// </summary>
        public string RegistrationCode { get; set; }
        /// <summary>
        /// 纳税人识别号
        /// </summary>
        public string TaxpayerCode { get; set; }
        /// <summary>
        /// 进出口企业代码
        /// </summary>
        public string ExportCode { get; set; }
        /// <summary>
        /// 所属行业
        /// </summary>
        public string IndustryCode { get; set; }
        /// <summary>
        /// 企业类型
        /// </summary>
        public string EnterpriseType { get; set; }
        /// <summary>
        /// 营业期限
        /// </summary>
        public string OperationEnding { get; set; }
        /// <summary>
        /// 登记机关
        /// </summary>
        public string Authority { get; set; }
        /// <summary>
        /// 人员规模
        /// </summary>
        public string StaffSize { get; set; }
        /// <summary>
        /// 参保人数
        /// </summary>
        public string InsuredSize { get; set; }
        /// <summary>
        /// 所属地区
        /// </summary>
        public string Area { get; set; }
        /// <summary>
        /// 曾用名
        /// </summary>
        public string OnceName { get; set; }
        /// <summary>
        /// 英文名
        /// </summary>
        public string EnglishName { get; set; }
        /// <summary>
        /// 企业地址
        /// </summary>
        public string CompanyAddress { get; set; }
        /// <summary>
        /// 经营范围
        /// </summary>
        public string CompanyScope { get; set; }

    }

    /// <summary>
    /// 主要人员
    /// </summary>
    public class Mpeople
    {
        public Mpeople()
        {
            TagList = new List<string>();
        }
        /// <summary>
        /// 标签
        /// </summary>
        public List<string> TagList { get; set; }
        public string ID { get; set; }
        public string IMG { get; set; }
        public string Name { get; set; }
        public string Relative { get; set; }
        public string Duty { get; set; }
        public string Nueducational { get; set; }
        public string Sex { get; set; }
        public string salary { get; set; }
        public string NumberOfShares { get; set; }
        public string PerOfShares { get; set; }
        public string UltimateBeneficiary { get; set; }
        public string TermOfOffice { get; set; }
        public string PostDate { get; set; }
    }

    /// <summary>
    /// 主要人员-关联列表
    /// </summary>
    public class PeopleRelatedlist
    {
        public PeopleRelatedlist()
        {
            CompanyTagList = new List<string>();
        }
        public string ID { get; set; }
        public string CompanyId { get; set; }
        public string CompanyIMG { get; set; }
        public string CompanyName { get; set; }
        public List<string> CompanyTagList { get; set; }
        public string LegalRepId { get; set; }
        public string LegalRepName { get; set; }
        public string Capital { get; set; }
        public string Area { get; set; }
        public string PerOfShares { get; set; }
        public string Duty { get; set; }
    }

    /// <summary>
    /// 对外投资
    /// </summary>
    public class ForeignInvestment
    {
        public ForeignInvestment()
        {
        }
        
        public string ID { get; set; }
        public string CompanyId { get; set; }
        public string CompanyIMG { get; set; }
        public string CompanyName { get; set; }
        public string LegalRepId { get; set; }
        public string LegalRepName { get; set; }
        public string LegalRepRelative { get; set; }
        public string Capital { get; set; }
        public string NumberOfShares { get; set; }
        public string PerOfShares { get; set; }
        public string BuildDate { get; set; }
        public string RegistrationStatus { get; set; }
        /// <summary>
        /// 融资
        /// </summary>
        public string Financing { get; set; }
        /// <summary>
        /// 融资日期
        /// </summary>
        public string FinancingDate { get; set; }
        /// <summary>
        /// 关联产品/机构
        /// </summary>
        public string RelativeProduct { get; set; }

    }



    //
    /// <summary>
    /// 最终受益人
    /// </summary>
    public class Beneficiary
    {
        public Beneficiary()
        {
            beneficiarypaths = new List<BeneficiaryPath>();
        }

        public string ID { get; set; }
        public string LegalRepId { get; set; }
        public string LegalRepIMG { get; set; }
        public string LegalRepName { get; set; }
        public string LegalRepRelative { get; set; }
        public string PerOfShares { get; set; }
        /// <summary>
        /// 股权链
        /// </summary>
        public List<BeneficiaryPath> beneficiarypaths { get; set; }

    }
    /// <summary>
    /// 投资线路
    /// </summary>
    public class BeneficiaryPath
    {
        public BeneficiaryPath()
        {
            legalreps = new List<LegalRep>();
        }

        public string Type { get; set; }
        public List<LegalRep> legalreps { get; set; }
        public string Remark { get; set; }
    }

    public class LegalRep
    {
        public LegalRep()
        {
        }

        public string LegalRepId { get; set; }
        public string LegalRepIMG { get; set; }
        public string LegalRepName { get; set; }
        public string LegalRepRelative { get; set; }
        public int Order { get; set; }
        
    }

    public class Dic
    {
        public string key { get; set; }
        public object value { get; set; }

    }
    /// <summary>
    /// 控制企业
    /// </summary>
    public class TouziCompany
    {
        public TouziCompany()
        {
            beneficiarypaths = new List<BeneficiaryPath>();
        }
        public string CompanyId { get; set; }
        public string CompanyIMG { get; set; }
        public string CompanyName { get; set; }
        public string PerOfShares { get; set; }
        public List<BeneficiaryPath> beneficiarypaths { get; set; }

    }
    /// <summary>
    /// 间接控制企业
    /// </summary>
    public class Indirectinvestment
    {
        public Indirectinvestment()
        {
        }
        public string CompanyId { get; set; }
        public string CompanyIMG { get; set; }
        public string CompanyName { get; set; }
        public string LegalRepId { get; set; }
        public string LegalRepIMG { get; set; }
        public string LegalRepName { get; set; }
        public string LegalRepRelative { get; set; }

        public string Capital { get; set; }
        public string IndirectPerOfShares { get; set; }
        public string BuildDate { get; set; }
        public string CompanyStatus { get; set; }

    }
    /// <summary>
    /// 疑似关系公司-联系方式关联
    /// </summary>
    public class Contactrel
    {
        public Contactrel()
        {
        }
        public string CompanyId { get; set; }
        public string CompanyIMG { get; set; }
        public string CompanyName { get; set; }
        public string LegalRepId { get; set; }
        public string LegalRepIMG { get; set; }
        public string LegalRepName { get; set; }
        public string LegalRepRelative { get; set; }
        public string Capital { get; set; }
        public string BuildDate { get; set; }
        public string ContactrelTpye { get; set; }
        public string ContactrelDetail { get; set; }

    }
    /// <summary>
    /// 疑似关系公司-联系方式关联
    /// </summary>
    public class Branche
    {
        public Branche()
        {
        }
        public string CompanyId { get; set; }
        public string CompanyIMG { get; set; }
        public string CompanyName { get; set; }
        public string LegalRepId { get; set; }
        public string LegalRepIMG { get; set; }
        public string LegalRepName { get; set; }
        public string LegalRepRelative { get; set; }
        public string RegistrationStatus { get; set; }


    }




    /// <summary>
    /// 对外投资
    /// </summary>
    public class Partnerscapi
    {
        public Partnerscapi()
        {
            TagList = new List<string>();
        }
        public List<string> TagList { get; set; }
        public string Id { get; set; }
        public string IMG { get; set; }
        public string Name { get; set; }
        public string Relative { get; set; }
        public string PerOfShares { get; set; }
        public string GiveMoney { get; set; }
        public string GiveDate { get; set; }

    }


    /// <summary>
    /// 工商自主公示- 股东及出资信息 
    /// </summary>
    public class Stockholder
    {
        public Stockholder()
        {
        }
        public string Id { get; set; }
        public string IMG { get; set; }
        public string Name { get; set; }
        public string Relative { get; set; }
        public string PerOfShares { get; set; }
        public string GiveMoney { get; set; }
        public string GiveDate { get; set; }
        public string ActGiveMoney { get; set; }
        public string ActGiveDate { get; set; }

    }
    /// <summary>
    /// 工商自主公示- 股权变更信息 
    /// </summary>
    public class StockChange
    {
        public StockChange()
        {
        }
        public string Id { get; set; }
        public string IMG { get; set; }
        public string Name { get; set; }
        public string Relative { get; set; }
        public string Before { get; set; }
        public string After { get; set; }
        public string ChangeDate { get; set; }
        public string PostDate { get; set; }

    }

    /// <summary>
    /// 财务分析
    /// </summary>
    public class newFinancialAnalysis
    {
        public newFinancialAnalysis()
        {
        }
        public string HTML { get; set; }

    }
    /// <summary>
    /// 同业分析
    /// </summary>

    public class newIndicatorData
    {
        public newIndicatorData()
    {
    }
        public string HTML { get; set; }

    }

    public class Changelist
    {
        public Changelist()
        {
        }
        public string HTML { get; set; }

    }



}
